# try-except-finally 案例
"""
try:
    # 尝试执行的代码
except ExceptionType:
    # 当异常发生时执行的代码
finally:
    # 无论是否发生异常都会执行的代码
"""


def divide_numbers(dividend, divisor):
    try:
        result = dividend / divisor
        print("The result is %s" % result)
    except ZeroDivisionError:
        print("Error: Division by zero is not allowed.")
    finally:
        print("The is the finally block.")


# 调用函数并传入参数
divide_numbers(10, 2) # 这将正常执行并输出结束
divide_numbers(10, 0) # 这将引发 ZeroDivisionError，并输出相应的错误消息
